package cn.hloger.spider.demo.authDemo.controller;

import cn.hloger.spider.demo.authDemo.handler.ParamDecodeHandler;
import cn.hloger.spider.demo.authDemo.vo.MarryResp;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 审贷婚姻联网核查接口
 */
@Slf4j
@Validated
@RequestMapping(value = "/engine")
@RestController
public class EngineController {

    @Autowired
    private ParamDecodeHandler paramDecodeHandler;

//    @Autowired
//    private EngineService engineService;

//    @Autowired
//    private LogService logService;

    /**
     *
     */
    @RequestMapping(value = "/rest/checkMarryBySingle", method = RequestMethod.POST)
    public MarryResp checkMarryBySingle(@RequestParam Map<String, String> paramsMap) {
        Map<String, String> dataMap = Maps.newHashMap();
        try {
            dataMap = paramDecodeHandler.decodeForMap(paramsMap);
//            restResult = engineService.checkMarryBySingle(new MarryVo(dataMap));
        } catch (Exception e) {
            log.error("服务出错" + e.getMessage());
//            restResult = RestResult.FAIL;
        } finally {
//            logService.add(paramsMap, dataMap, restResult);
        }
        return null;
    }


    @RequestMapping(value = "/rest/checkMarryByDouble", method = RequestMethod.POST)
    public MarryResp checkMarryByDouble(@RequestParam Map<String, String> paramsMap) {
        Map<String, String> dataMap = Maps.newHashMap();
        try {
            dataMap = paramDecodeHandler.decodeForMap(paramsMap);
//            restResult = engineService.checkMarryByDouble(new MarryVo(dataMap));
        } catch (Exception e) {
            log.error("服务出错" + e.getMessage());
//            restResult = RestResult.FAIL;
        } finally {
//            logService.add(paramsMap, dataMap, restResult);
        }
        return null;
    }


}
